#!/bin/bash -e

function info() {
echo Usage: `basename $0` '[-n nun] [-r proportion] in.fq'
exit 65
}

while getopts  ":s:p:n:r:" opts
do
        case  $opts  in
		s) sample_name=$OPTARG;;
		p) out_prefix=$OPTARG;;
		n) num=$OPTARG;;
		r) prop=$OPTARG;;
		*) info;;
		esac
done
shift $(($OPTIND - 1))

if [ -z "$1" ]; then info; fi


. /mnt/ilustre/app/medical/tools/.var


if test -n "$prop"; then

	fastq-sample -p$prop -o$out_prefix $1

elif test -n "$num"; then

	fastq-sample -n$num -o$out_prefix $1

else
	fastq-sample -o$out_prefix $1

fi

. $cmd_done